<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
var productExceptself = function(nums) {
    var arr = []
    var sum = 1
    for( var i = 0 ; i<nums.length ; i++ ){
        for( var k = 0 ; k<nums.length ; k++ ){
            if( k == i ){
                continue
            }
            sum = sum * nums[k]
        }
        arr.push(sum)
        sum = 1
    }
    return arr
}

var nums = [ 1 , 2 , 3 , 4 ]
console.log(productExceptself(nums))
    </script>
</body>
</html>